import { createRouter, createWebHistory } from 'vue-router'
import routes from './routes.js'
import { titleController } from '@/utils'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  // history: createWebHistory(),
  routes
})
router.afterEach((to) => {
  // console.log(from, "<from");
  // console.log(to, "<to");
  if (to.meta.title) {
    titleController.setRouteTitle(to.meta.title)
  }
})
export default router
